string1 = codesters.Line(-130, 100, 0, -100, "black")
string2 = codesters.Line(-50, 125, 0, -100, "black")
string3 = codesters.Line(20, 180, 0, -100, "black")
string4 = codesters.Line(105, 140, 0, -100, "black")
stage.set_background("city")
sprite = codesters.Sprite("person2")
sprite.go_to(0, -100)
balloon_size = 100
# sprite = codesters.Circle(x, y, diameter, "color")
balloon1 = codesters.Circle(-130, 100, balloon_size, "purple")
balloon2 = codesters.Circle(-50, 125, balloon_size, "purple")
balloon3 = codesters.Circle(20, 180, "balloon_size", "purple")
balloon4 = codesters.Circle(105, 140, "balloon_size", "purple")
t = codesters.Teacher()
try:
params = t.get_parameters_for_function('Circle')
tval_1 = 0
# you need to iterate through each sublist in the list
# this will count the number of times the variable x is used in Square commands
for sublist in params:
if sublist[2] == '"balloon_size"':
tval_1 += 1
except:
tval_1 = "DNE"
try:
params = t.get_parameters_for_function('Circle')
tval_3 = 0
# you need to iterate through each sublist in the list
# this will count the number of times the variable x is used in Square commands
for sublist in params:
if sublist[2] == "balloon_size":
tval_3 += 1
except:
tval_3 = "DNE"
try:
params = t.get_parameters_for_function('Circle')
tval_2 = 0
for sublist in params:
if sublist[2] == 100:
tval_2 += 1
except:
tval_2 = "DNE"
tester = TestManager()
t1 = TestObjective()
t1.add_failure(tval_1 > 0, "Do you have quotes around a variable name?")
t1.add_failure(tval_2 > 0, "You used the value instead of the variable name.")
t1.add_success(tval_3 == 4, "Great job debugging the program!")
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)